'++LotusScript Development Environment:2:5:(Options):0:66 '++LotusScript Development Environment:2:5:(Forward):0:1 Declare Sub Switchto(Source As Form, View As VIEW) Declare Sub NewWinTitle Declare Sub ClearVals Declare Sub Pageswitch(Source As Form, Pagefrom As Long, Pageto As Long) Declare Sub Switchfrom(Source As Form, View As VIEW) Declare Sub SetPanel2 '++LotusScript Development Environment:2:5:(Declarations):0:2 '++LotusScript Development Environment:2:2:BindEvents:1:129 Private Sub BindEvents(Byval Objectname_ As String) Static Source As FORM Set Source = Bind(Objectname_) On Event Switchto From Source Call Switchto On Event Pageswitch From Source Call Pageswitch On Event Switchfrom From Source Call Switchfrom End Sub '++LotusScript Development Environment:2:2:Switchto:1:12 Sub Switchto(Source As Form, View As VIEW) 'This will set the window title of the dialogue box: NewWinTitle ' CurrentApplication.visible = False Dim Clearit(0) As String Dim opendocs() As String 'Array of documents open 'Make sure the web assistant is the active view 'Go to the Web Assistant 'Duplicate - this is also in the open document event: 'Set CurrentWindow.Activeview =CurrentApplications.db2www.WWW~ Assistant arycnt = 0 'Clear the values if this is the first time the assistant has been loaded If gFlagLoaded = 0 Then Call ClearVals End If 'Make sure that all of the done buttons from panel 3 to 5 are blackened: With CurrentDocument.WWW~ Assistant.body .btnp3done.font.color.setrgb color_black .btnp4done.font.color.setrgb color_black .btnp5done.font.color.setrgb color_black End With 'Temporary - for re-running and testing 'If gCurPage=0 Then ' gCurPage = 1 'End If 'Put the dialogue on the last panel used by user On Error Resume Next CurrentView.CurrentPageNum = gCurPage CurrentDocument.Modified = False End Sub '++LotusScript Development Environment:2:2:NewWinTitle:1:8 Sub NewWinTitle 'Rename the window title for the dialogue so that it has the title we want instead of the apr file name Dim activeWin As Integer, winTitle As String activeWin% = GetActiveWindow() winTitle$ = "DB2 Web Sizing Assistant" SetWindowTextA activeWin%, winTitle$ End Sub '++LotusScript Development Environment:2:2:ClearVals:1:8 Sub ClearVals 'Dim obtype As Long Dim ClearIt(0) As String Dim opendocs() As String 'Array of documents open 'blank out some values and set some default values numrows = 0 c = 0 'Let's empty the listbox for opendocs CurrentDocument.www~ assistant.body.lbopenapps.setlist(ClearIt) CurrentDocument.www~ assistant.body.lbformsp2.setlist(ClearIt) CurrentDocument.www~ assistant.body.lbReportsP2.setlist(ClearIt) '**************There's currently a problem with accesssing all the objects on a multipage form, so we'll specify 'what we want cleared: With CurrentDocument.WWW~ Assistant.body .txtimagepath.text = "\images" .txtmacropath.text = "" .txtExeName.text = "" .txtnumrows.text="" .cbxPromptUserid.setstate(True) .cbxUseUserid.setstate(True) .cbxUsePswd.setstate(True) .rdoSqlOff.setstate(True) .rdoSearchAnd.setstate(True) .rdoNoConvert.setstate(True) .rdoFormPost.setstate(True) 'Let's set default values into the Step 3 screen: .txtUserid.readonly = 0 .txtPswd.readonly = 0 .txtUserid.background.color.setrgb color_white .txtPswd.background.color.setrgb color_white .txtUserid.text = "userid" .txtPswd.text = "password" 'Default values in panel 4: .txtNumRows.text = "0" 'The number of rows to return in the report 'default values in panel 5: .txtImagePath.text = "/images/" .txtExeName.text = "/cgi-bin/db2www.exe" End With Redim opendocs( 0 To CurrentApplication.Documents.count-1) i = 0 Forall documents In CurrentApplication.documents 'Let's not bother to include the Web Assistant apr - this is confusing to users If Left$(Lcase$(CurrentApplication.documents(i).name),6) <> "db2www" Then CurrentDocument.www~ assistant.body.lbopenapps.addlistitem(CurrentApplication.documents(i).name) opendocs(arycnt) = CurrentApplication.documents(i).name arycnt = arycnt + 1 End If i = i + 1 End Forall '********End of filling the listbox On Error Goto NoIndex CurrentDocument.www~ assistant.body.lbopenapps.text = opendocs(0) 'Indicate that we've cleared this once and not to do it again gFlagLoaded = 1 NoIndex: If Error = "Subscript out of range" Then Exit Sub End If End Sub '++LotusScript Development Environment:2:2:Pageswitch:1:12 Sub Pageswitch(Source As Form, Pagefrom As Long, Pageto As Long) Dim Formselected As String, RptSelected As String On Error Resume Next Select Case CurrentView.currentpagenum Case 1 gPageLoaded=0 MacName$ = "" 'Reset the macroname Case 2 If CurrentDocument.www~ assistant.body.lbopenapps.text = "" Then Messagebox "No Document Has Been Selected",, "Error" CurrentView.currentpagenum = 1 Exit Sub End If If gPageLoaded = 0 Then Call SetPanel2 End If Case 3 Flag = 0 If MacName$ = "" Then MacName$ = Mid$(currentapplication.documents(DocIndex).fullname, 1, Len(currentapplication.documents(DocIndex).fullname)-3) &"d2w" End If With CurrentDocument.WWW~ Assistant.body rptAsForm = Val(.cbxRptAsForm.value) If rptAsForm = 1 Then FormSelected = .lbReportsP2.text Else FormSelected = .lbformsP2.text End If RptSelected = .lbReportsP2.text End With If FormSelected = "" Then 'No Form was selected Msgbox "You must select a form",, "No Form Selected" CurrentView.currentpagenum = 2 End End If If RptSelected = "" Then 'No report was selected Msgbox "You must select a Report",, "No Report Selected" CurrentView.currentpagenum = 2 End End If CurrentDocument.www~ Assistant.body.txtMacName.text = MacName$ Case 4,5 If CurrentDocument.www~ Assistant.body.txtdbname.text = "" Then Msgbox "Please fill in database name",, "Database name required" Currentview.currentpagenum = 3 CurrentDocument.www~ Assistant.body.txtdbname.setfocus End End If Macname$ = CurrentDocument.www~ assistant.body.txtMacName.text End Select WhatNow: If Flag = 1 Then PrevPage Messagebox "Please make new selections that have the same main table",,"New Selection" End End If 'Clear errors Err = 0 End Sub '++LotusScript Development Environment:2:2:Switchfrom:1:12 Sub Switchfrom(Source As Form, View As VIEW) Dim rval As Integer 'Check to see if we want to exit: If currentwindow.activeview.name <> "WWW Assistant" And currentwindow.activeview.name <> "Web Background" And currentwindow.activeview.name <> "Warning Message Table"Then Call QuitAssistant() End If End Sub '++LotusScript Development Environment:2:2:SetPanel2:1:8 Sub SetPanel2 If CurrentView.currentpagenum = 2 Then Dim FrmList() As String 'Array of forms in the view Dim RptList() As String 'Array of reports in the view Dim ClearIt(0) As String Dim DocSelected As String 'Empty the listboxes so that they don't have old info in them 'CurrentApplication.db2www.www~ assistant.body.lbformsp2.setlist(ClearIt) 'CurrentApplication.db2www.www~ assistant.body.lbReportsP2.setlist(ClearIt) 'Put the user's selection in the global variable DocSelected = CurrentDocument.www~ assistant.body.lbopenapps.text DocIndex = GetDocIndex(DocSelected) 'Let's get the list of forms and reports from the selected document: rvalForms = Getforms(DocIndex, frmlist) rvalReports = GetRpts(DocIndex, rptlist) 'If there aren't any forms or reports found, then let the user know: If rvalForms = 0 And rvalReports = 0 Then Messagebox "No Reports or Forms found in the selected document" &_ Chr(10) & "Select another document", , "Error" PrevPage Exit Sub End If 'Let's stick those lists in the corresponding list boxes CurrentDocument.www~ assistant.body.lbformsp2.setlist(frmlist) CurrentDocument.www~ assistant.body.lbReportsP2.setlist(Rptlist) 'Let's make the first item in each list the default value: On Error Resume Next CurrentDocument.www~ assistant.body.lbformsp2.text = FrmList(0) CurrentDocument.www~ assistant.body.lbReportsP2.text = RptList(0) gPageLoaded = 1 End If End Sub